{extend name="layout/detail" /}

{block name="content"}
<input type="hidden" name="ajax" id="ajax" value="1">
<div class="td-content-wrap p20">
    <div class="td-content-header">
        <h1 class="main-title">字段编辑</h1>
    </div>
    <hr>
    <div class="space-20"></div>
    <form id="form_data" class="layui-form" method="post" action="{:url('save')}">
        <input type="hidden" name="opmode" value="edit">
        <input type="hidden" name="id" value="{$vo.id}">
        <div class="layui-form-item">
            <label class="layui-form-label required">表名：</label>
            <div class="layui-input-block w40">
                <div class="layui-form-mid">{:request()->param('table')}</div>
            </div>
        </div>
        <hr>
        <table id="data_table" lay-filter="data_table"></table>
    </form>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['common', 'data_table'], function () {
        let data_table = layui.data_table;

        let cols = [[
            {
                field: 'name',
                title: '标题',
            },
            {
                field: 'category_name',
                title: '分类',
                sort: true,
                width: 160
            },
            {
                field: 'author',
                title: '作者',
                width: 160
            },
            {
                field: 'post_time',
                title: '发布日期',
                sort: true,
                width: 160
            },
            {
                toolbar: '#tool_bar',
                title: '操作',
                width: 280,
                fixed: 'right',
            }]];

        data_table.config.cols = cols;
        data_table.render();

    });
</script>
{/block}
